<template>
	<view class="indexs">
		<view class="header header_lan" :style="'padding-top: ' + navH + 'px;'">
			<view class="header_height" :style="'height:' + gaodu + 'px;line-height:' + gaodu + 'px;top:' + gaodutops + 'px;'">
				<view class="index_h_cont3">
					<view class="index_wenben_img" @tap="jumpzuo"><image :src="imgUrl + '/dzx_img22.png'" mode="widthFix"></image></view>
					<view class="index_wenben baise">{{ $t('page_worker_index.Franchise_application') }}</view>
				</view>
			</view>
			<view class="coloe_title">s</view>
		</view>
		<view class="container">
			<view class="no-dealer">
				<view class="no-icon dis-flex flex-x-center"><image :src="imgUrl + '/dzx_img43.png'" mode="widthFix"></image></view>
				<view class="no-msg dis-flex flex-x-center f-30" style="">{{ words.index.words.not_dealer.value }}</view>
				<!-- 立即申请 -->
				<view class="no-submit form-submit dis-flex flex-x-center">
					<form @tap="triggerApply" report-submit="true">
						<button formType="submit">{{ words.index.words.apply_now.value }}</button>
					</form>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
const app = getApp();
let request = require('../../../../utils/require');

export default {
	data() {
		return {
			isData: false,
			words: {},
			user: {},
			dealer: {},
			imgUrl: app.globalData.imgUrl,
			navH: app.globalData.navHeight,
			gaodu: app.globalData.height,
			banertrue: false,
			is_worker: false
		};
	},
	/**
	 * 生命周期函数--监听页面加载
	 */ onLoad(options) {
		var that = this;
	},
	onShow() {
		var that = this;
		// 获取分销商中心数据
		that.getDealerCenter();
	},
	/**
	 * 生命周期函数--监听页面初次渲染完成
	 */
	onReady: function() {},
	/**
	 * 生命周期函数--监听页面隐藏
	 */
	onHide: function() {},
	/**
	 * 生命周期函数--监听页面卸载
	 */
	onUnload: function() {},
	/**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
	onPullDownRefresh: function() {},
	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom: function() {
		if (this.ispage) {
			this.page= this.page + 1
			this.baoguolist(this.type);
		}
	},
	onPageScroll: function(e) {
		if (e.scrollTop > this.navH + 50) {
			this.banertrue= true
		} else {
			this.banertrue= false
		}
	},
	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage: function() {},

	methods: {
		/**
		 * 获取分销商中心数据`index.php?s=/api/user.dealer/center&wxapp_id=` + uni.getStorageSync('web_id')
		 */
		getDealerCenter() {
			var that = this;
			var data = {
				token: uni.getStorageSync('token')
			};
			request.get(`index.php?s=/api/shop.worker/center&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				if (res.data.code == 1) {
					// 设置当前页面标题
					uni.setNavigationBarTitle({
						words: res.data.data.words.index.title.value
					});
					that.words= res.data.data.words,
					that.is_worker= res.data.data.is_worker
				}
			});
		},

		/**
		 * 跳转到提现页面
		 */
		navigationToWithdraw() {
			wx.navigateTo({
				url: '../withdraw/apply/apply'
			});
		},

		/**
		 * 立即加入分销商
		 */
		triggerApply(e) {
			// 记录formId
			// App.saveFormId(e.detail.formId);
			wx.navigateTo({
				url: '../worker_apply/apply'
			});
		},
		jumpzuo() {
			uni.navigateBack();
		}
	}
};
</script>
<style>
@import './worker_index.css';
</style>
